{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[167.57585059]\n",
      "120.25303450115287\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deZwddZnv8c+XLBAWE4QYIYthieECBgItBEGvEGSXxC3gqCxyyeigoCgKXiYs4x1kUFFkBg1hIDBsYY8MshhAHBUwCyQsohHBpNkCJmFJhJA894/6nZOTppfqdNepk+7v+/U6r1P1qzpVz6mk++n61a+eUkRgZmYGsFHZAZiZWeNwUjAzsyonBTMzq3JSMDOzKicFMzOr6lt2AF2x9dZbx8iRI8sOw8xsgzJnzpyXI2Jwa8s26KQwcuRIZs+eXXYYZmYbFEnPtrXM3UdmZlblpGBmZlVOCmZmVuWkYGZmVU4KZmZW5aRgZmZVTgpmZlblpGBmZlVOCmZmjW7+DLhwVzh7UPY+f0Zhu9qg72g2M+vx5s/g7du+St/Vf8/mly/K5gHGTOr23flMwcysga34xZS1CSHpu/rvrPjFlEL256RgZtbANln5Qqfau8pJwcysgT23ZqtOtXeVk4KZWQOb1v/zrIj+67StiP5M6//5QvbnpGBm1sB2P3wyU2Iyi9dszZoQi9dszZSYzO6HTy5kfx59ZGbWwCaOHQr8E0fdNZ7nlq1k20EDOO3g0am9+zkpmJk1uIljhxaWBFpy95GZmVU5KZiZWZWTgpmZVTkpmJlZlZOCmZlVOSmYmVmVk4KZmVU5KZiZWZWTgpmZVRWaFCSdIukxSY9L+lpqe7ekeyT9Kb1vmdol6SJJCyXNl7RHkbGZmdk7FZYUJO0KnAjsBewGHCFpR+B0YFZEjAJm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fiLpEKCtKraVYoG133U/siJuRMSdwNJWPrc3cH9ELImIt1rEtA9wTZq+Km2vPfsrezLaAuAAoLaMee12fwNcIelEoE8H27QG52sKVpY3a6ZXk/0l2p5VNTWQVrP2/+5GwLiI+Hs7n/068CKwW1q/vXUrrgO+Qlb7ZnZEvJa6T+6JiM+28Zk3OtpoRCyVtBtwMPAlYBLwxVZWrRyf2u9aN5I2Af4DaIqIRZLOBjapWaX6XSPiS5L2JkuecyTtGRGlVI61rvOZghXp18BESZumrphPpLbudDfw1cqMpN1bWWcg8HxErCEryFf5a/YB4KjUz78NsH/NZ34F7EHWTXVdansQ2FfSjmlfm0l6fxtxvQZs0bIxdUFtFBE3kXVFdebZur8hSyJIOgjYspV1HgL+t6StlJUp/0zNst+ytvjc52j/36KSAF5OZ15tjkiStENEPJQuli9h3ZLOtoHxmYIVJrJnMV8BPJyapkXEPHXvg9pPBv5d0nyy/88PkP0FXus/gJskHUPWLVT5K/cWsm6RJ4C/Ar+riX11urh8HKnMc0QskXQccK2kjdOqZwJ/bC7JbH0AAACmSURBVCWuK4CfSlpJ1m1TMRS4XFLlD7IzOvFdz0n7/kKK9QWy5FMVEc+nv+p/R3at5pGaxV9N+z6N7Jd3m5U1I2KZpEvJRlC9APy+nbgukDQKEDALeLQT38kajKukmm0gUiJaHRFvS9oHuCQ9gc2s2/hMwWzDMQKYkc4y3mLtCCyzbuMzBTMzq/KFZjMzq3JSMDOzKicFMzOrclIwM7MqJwUzM6v6/1bQeJ9ueMVMAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.linear_model import HuberRegressor\n",
    "#Huber损失函数\n",
    "#向量用大写形式表示\n",
    "X_train = np.array([1.7, 1.5, 1.3, 5, 1.3, 2.2])\n",
    "#标量或者预测值用小写表示\n",
    "y_train = np.array([368, 340, 376, 954, 332, 556])\n",
    "#使用默认的值进行初始化\n",
    "huber = HuberRegressor()\n",
    "#在scikit-learn中，训练数据x是二维数组，例子中是单维特征，需要变成二维数组\n",
    "X_train = X_train.reshape(-1, 1)\n",
    "#训练模型参数\n",
    "huber.fit(X_train, y_train)\n",
    "y_train_predict_huber = huber.predict(X_train)\n",
    "plt.scatter(X_train, y_train, label=\"Train Simples\")\n",
    "plt.scatter(X_train, y_train_predict_huber, label=\"Predict Simples\")\n",
    "plt.xlabel(\"online advertising dollars\")\n",
    "plt.ylabel(\"monthly e-commenerce sales\")\n",
    "#系数\n",
    "print(huber.coef_)\n",
    "#截距项\n",
    "print(huber.intercept_)\n",
    "plt.show()\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
